<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>键盘事件</title>
</head>
<body>
	<textarea name = "" id ="text" cols ="30" rows="10"></textarea>
	<script type="text/javascript">
	//获取元素
	var text =document.getElementById('text');

	//键盘按下的事件
	text.onkeydown =function()
	{
		console.log('down');
	}
	//onkeypress
	text.onkeypress =function()
	{
		console.log('press');
		//return false;
	}
	// onkeyup	
	text.onkeyup =function()
	{
		console.log('up');
	}


	</script>
</body>
</html>